<?php
namespace app\index\controller;
use think\Controller;
class Common extends Controller{

    protected $seo = [];

    public function _initialize(){
        // 判断网站是否关闭
        if (\ebcms\Config::get('system.site_closed')) {
            $this -> error(\ebcms\Config::get('system.site_closed_reason'));
        }
        
        if (request() -> isGet()) {

            // 判断是否开启统计
            if (\ebcms\Config::get('tongji.tongji_on')) {
                \think\Hook::add('app_end','app\\index\\behavior\\Tongji');
            }

            $config = \ebcms\Config::get('index');
            $this -> seo = [
                'sitename' => $config['sitename'],
                'title' => $config['title'],
                'keywords' => $config['keywords'],
                'description' => $config['description'],
            ];
        }
    }
}